<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean"
	prefix="bean"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html"
	prefix="html"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic"
	prefix="logic"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<title>JSP for ModifyatomForm form</title>
		<LINK href="css/default.css" rel=stylesheet>

		<style type="text/css">
#id1 {
	width: 100%;
	height: 100%;
	background-color: #000;
	FILTER: alpha(opacity =                                         50);
	position: absolute;
	top: 0;
	left: 0;
	moz-opacity: 0.8;
	opacity: .80;
	z-index: 49;
	display: none;
}

#id2 {
	top: 200px;
	position: absolute;
	z-index: 50;
	display: none;
	border: 3px solid #E5E5E5;
	left: 100px;
	background-color: white;
}
</style>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title></title>
		<script language="javascript" type="text/javascript">
		function show(){
			id1.style.height=document.body.scrollHeight+"px";
			id1.style.width=document.body.scrollWidth+"px";
			id1.style.display='block';
			id2.style.display='block';
		}
		function hide(){
			id1.style.display='none';
			id2.style.display='none';
		}
		function choose(){
		n=document.getElementById("ATOMKINDID");
		m=document.getElementById("BIZATOMFLAG");
		if(n.value=="0"&&m.value=="0"){
			condition=" ";
		}else{
			condition=" where "
			if(n.value!="0"){
			condition=condition+"ATOM_KIND_ID = "+n.value;
			}
			if(m.value!="0" && condition==" where "){
			condition=condition+"BIZ_ATOM_FLAG = "+m.value;
			}else if(m.value!="0"){
			condition=condition+" and BIZ_ATOM_FLAG = "+m.value;
			}
		}
		document.modifyatomForm.condition.value=condition;
		document.modifyatomForm.operation.value="list";
		document.modifyatomForm.submit();
		}
	</script>
	</head>
	<body>
		<%
		String way = request.getParameter("way");
		%>
		<html:form action="/modifyatom.do">
			<%
			if (way.equals("1")) {//list 列出已经存在的原子组
			%>
			<table border="0" width="700" align="center" cellpadding="3"
				cellspacing="1" bgcolor="#FF9900">
				<tr>
					<th>
						所属类别
					</th>
					<th>
						原子组名
					</th>
					<th>
						原子组描述
					</th>
					<th>
						<a href="modifyatom.do?way=1&operation=list">新增</a>
					</th>
				</tr>
				<logic:iterate name="allGroupList" id="i">
					<tr bgcolor="ffffff">
						<td class="alt">
							<logic:lessEqual name="i" property="BOOKMARK_ID" value="7">客户</logic:lessEqual>
							<logic:greaterThan name="i" property="BOOKMARK_ID" value="7">用户</logic:greaterThan>
						</td>
						<td class="alt">
							<bean:write name="i" property="ATOM_GROUP_NAME" />
						</td>
						<td>
							<bean:write name="i" property="ATOM_GROUP_DESC" />
						</td>
						<td>
							<a
								href="modifyatom.do?operation=modbox&way=1&checkid=<bean:write name="i" property="ATOM_GROUP_ID"/>">查看<br> </a>
						</td>
					</tr>
				</logic:iterate>
				<%
				}
				%>
			</table>
			<%
			if (way.equals("2")) {//列出已经存在的原子
			%>
			<center>
				<div id="tbl-container">
					<table width="740" id="tbl" border="0" width="700" align="center"
						cellpadding="0" cellspacing="1">
						<thead>
							<tr height="20">
								<th>
									原子名
								</th>
								<th>
									<select id="ATOMKINDID" name="ATOMKINDID" onchange="choose()">
										<option value=0>
											全部
										</option>
										<option value=1>
											客户
										</option>
										<option value=2>
											用户
										</option>
										<option value=3>
											通用
										</option>
									</select>
									<script type="text/javascript">
										document.getElementById("ATOMKINDID").value=<%=request.getParameter("ATOMKINDID") == null ? "0"
						: request.getParameter("ATOMKINDID")%>;
									</script>
								</th>
								<th>
									代码来源表
								</th>
								<th>
									基础数据来源表
								</th>
								<th>
									<select id="BIZATOMFLAG" name="BIZATOMFLAG" onchange="choose()">
										<option value=0>
											单位:全
										</option>
										<option value="'time'">
											单位:时长
										</option>
										<option value="'money'">
											单位:钱数
										</option>
										<option value="'other'">
											单位:其他
										</option>
										<option value="'count'">
											单位:计数
										</option>
									</select>
									<script type="text/javascript">
										document.getElementById("BIZATOMFLAG").value="<%=request.getParameter("BIZATOMFLAG") == null ? "0"
								: request.getParameter("BIZATOMFLAG")%>";
									</script>
								</th>
								<th>
									<a href="modifyatom.do?way=2&operation=list">新增</a>
								</th>
							</tr>
						</thead>
						<tbody>
							<logic:iterate name="allList" id="i" offset="startRowNo"
								length="pageSize">
								<tr bgcolor="ffffff" height="22">
									<td>
										<bean:write name="i" property="BIZ_ATOM_NAME" />
									</td>
									<td class="alt">
										<logic:equal name="i" property="ATOM_KIND_ID" value="1">
									客户
									</logic:equal>
										<logic:equal name="i" property="ATOM_KIND_ID" value="2">
									用户
									</logic:equal>
										<logic:equal name="i" property="ATOM_KIND_ID" value="3">
									通用
									</logic:equal>
									</td>
									<td class="alt">
										<bean:write name="i" property="CDE_SRC_TABLE_NAME" />
									</td>
									<td>
										<bean:write name="i" property="BAS_TABLE_NAME" />
									</td>
									<td class="alt">
										<bean:write name="i" property="BIZ_ATOM_FLAG" />
									</td>
									<td class="alt">
										<a
											href="modifyatom.do?operation=modbox&way=2&checkid=<bean:write name="i" property="BIZ_ATOM_ID"/>">查看</a>
									</td>
								</tr>
							</logic:iterate>
							<tr>
								<td align="center" colspan="7">
									<a href="modifyatom.do?operation=list&way=2&paging=first">首页</a>
									<a href="modifyatom.do?operation=list&way=2&paging=previous">上一页</a>
									<a href="modifyatom.do?operation=list&way=2&paging=next">下一页</a>
									<a href="modifyatom.do?operation=list&way=2&paging=last">尾页</a>
									&nbsp;&nbsp;&nbsp;&nbsp; 第
									<bean:write name="currPage" />
									/
									<bean:write name="maxPage" />
									页
								</td>
							</tr>
						</tbody>
						<%
						}
						%>
					</table>
				</div>
			</center>
				<br>
				<table width="400" border="0" align="center" cellpadding="0" cellspacing="1"
					bgcolor="#FF9900">
					<tr>
						<td>
							<div id=groupdiv>
								原子组名 ：
							</div>
						</td>
						<td>
							<%
							if (way.equals("1")) {
							%>
							<html:select property="prename">
								<html:option value="">请选择菜单类</html:option>
								<html:option value="8">用户基本属性</html:option>
								<html:option value="9">用户价值属性</html:option>
								<html:option value="10">用户行为属性</html:option>
								<html:option value="11">用户竞争属性</html:option>
								<html:option value="12">用户套餐属性</html:option>
								<html:option value="13">用户定义属性</html:option>
							</html:select>
							<html:errors property="prename" />
							<%
								}
								if (way.equals("2")) {
							%>
							<html:select property="prename">
								<html:option value="">请选择原子组</html:option>
								<logic:iterate name="allGroupList" id="i">
									<option value=<bean:write name="i" property="ATOM_GROUP_ID"/>>
										<bean:write name="i" property="ATOM_GROUP_NAME" />
									</option>
								</logic:iterate>
							</html:select>
							<%
							}
							%>
						</td>
					</tr>
					<tr>
						<td>
							ID：
						</td>
						<td>
							<html:text property="BIZ_ID" />
							<html:errors property="BIZ_ID" />
						</td>
					</tr>
					<tr>
						<td>
							<div id=namediv>
								原子名称 ：
							</div>
						</td>
						<td>
							<html:text property="name" />
							<html:errors property="name" />
						</td>
					</tr>
					<tr>
						<td>
							<div id=BIZ_DESCdiv>
								原子描述 ：
							</div>
						</td>
						<td>
							<html:text property="BIZ_DESC" />
							<html:errors property="BIZ_DESC" />
						</td>
					</tr>

				</table>
				<%
				if (way.equals("2")) {
				%>
				<div id="addatominfo">
					<table width="400" border="0" align="center" cellpadding="0" cellspacing="1">
						<tr>
							<td>
								值类型:
							</td>
							<td>
								<html:select property="VALUE_TYPE_ID">
									<option value="1">
										数字型
									</option>
									<option value="2">
										字符型
									</option>
								</html:select>
							</td>
						</tr>
						<tr>
							<td>
								展示方式：
							</td>
							<td>
								<html:select property="SHOW_TYPE_ID">
									<logic:iterate id="showtype" name="atomShowType">
										<option
											value="<bean:write name="showtype" property="SHOW_TYPE_ID"/>">
											<bean:write name="showtype" property="SHOW_TYPE_NAME" />
										</option>
									</logic:iterate>

								</html:select>
							</td>
						</tr>
						<tr>
							<td>
								代码来源表：
							</td>
							<td>
								<html:text property="CDE_SRC_TABLE_NAME"></html:text>
							</td>
						</tr>
						<tr>
							<td>
								基础数据来源表：
							</td>
							<td>
								<html:text property="BAS_TABLE_NAME"></html:text>
							</td>
						</tr>
						<tr>
							<td>
								基础表字段名：
							</td>
							<td>
								<html:text property="BAS_TABLE_COL_NAME"></html:text>
							</td>
						</tr>
						<tr>
							<td>
								基础表字段类型：
							</td>
							<td>
								<html:text property="BAS_TABLE_COL_TYPE"></html:text>
							</td>
						</tr>
						<tr>
							<td>
								业务原子类别标识：
							</td>
							<td>
								<html:select property="ATOM_KIND_ID">

									<option value="2">
										只适用于客户
									</option>
									<option value="1">
										只适用于用户
									</option>
									<option value="3">
										适用于两者
									</option>
								</html:select>
							</td>
						</tr>
						<tr>
							<td>
								原子单位标志：
							</td>
							<td>
								<html:select property="BIZ_ATOM_FLAG">
									<option value="time">
										时间
									</option>
									<option value="money">
										钱数
									</option>
									<option value="other">
										其他
									</option>
								</html:select>
							</td>
						</tr>
						<tr>
							<td>
								源表中文字段名：
							</td>
							<td>
								<html:text property="SRC_TABLE_COL_NAME" />
							</td>
						</tr>

					</table>

				</div>

				<%
				}
				%>
				<center>
					<img src='images/button_true.gif' width="63" height="21" onclick="document.forms[0].submit();" />
					&nbsp;&nbsp;
					<img src='images/button_cancel.gif' width="63" height="21" onclick="" />
				</center>
			
			<html:hidden property="operation" value="add" />
			<input type="hidden" name="way" />
			<input type="hidden" name="condition" />
		</html:form>
		
		<script type="text/javascript">
			var wayop=<%=way%>;
			document.all.way.value=wayop;
			if(wayop=="1"){
				document.all.groupdiv.innerText="所属分类菜单:";
				document.all.namediv.innerText="原子组名称:"
				document.all.BIZ_DESCdiv.innerText="原子组描述:"
			}
			if(wayop=="3"){
				document.all.groupdiv.innerText="所属原子名称:";
				document.all.namediv.innerText="原子项名称：";
				document.all.BIZ_DESCdiv.innerText="原子项描述：";
			}
		</script>
	</body>
</html>

